package com.iisigroup.audf.statistics;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;

public class RegularExtract {

    /**
     * @param args
     */
    public static void main(String[] args) {
	String regex ="(TX.*)\\s*\\|\\s*(.*)\\s*\\|\\s*(.*)";
	
	String sample ="TXGLRL1405131459564313 | RL02100 | 00:48.702";
	
	String[] strArray = StringUtils.splitPreserveAllTokens(sample ,'|');
	final	Matcher matcher = Pattern.compile(regex).matcher(sample);
	while(matcher.find()){
	    int groupCount = matcher.groupCount();
	    for(int i = 0 ; i <groupCount ; ++i){
		String catchData= matcher.group(i);
		System.out.println(catchData);
	    }
	    
	    
	}
	System.out.println(strArray.length);
    }

}
